﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="java.text.DecimalFormat"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">

<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../css/base.css" media="all" />

<%
//String view = view;
	String view = "";
%>
</head>

<body id="wrap_bg">
<jsp:include page="../bizring_header1.jsp"/>
	<div id="container">
		<!-- left-->		
	    <h2 class="hidden">sub_menu</h2>
		<div id="left_part">
			<div id="left_menu">
				<ul>
					<li><a href="#" onmouseout="" onmouseover="" onblur="" onfocus=""><img src="../images/gaul/left_title.gif" alt="Business Contact" /></a></li>
				</ul>
		    </div>
		</div>
	    <h2 class="hidden">contacts</h2>
		<div id="body_part">
			<div id="body_con">
				<div class="busi_top">
					<ul>
						<li class="date">
<%
	String connectionUrl = "jdbc:sqlserver://112.78.183.95:14333;databaseName=bizring";
	String userid = "sa";
	String passwd = "qlalf@sql";
	
	// Declare the JDBC objects.
	java.sql.Connection con = null;
	java.sql.Statement stmt = null;
	java.sql.ResultSet rs = null;

	// Establish the connection.
	Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

	try {   
		// Create and execute an SQL statement that returns some data.
		String SQL = "SELECT GETDATE() as now";
		
		con = java.sql.DriverManager.getConnection(connectionUrl, userid, passwd);
		stmt = con.createStatement();
		rs = stmt.executeQuery(SQL);
		
		// Iterate through the data in the result set and display it.
		while (rs.next()) {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
			Date today = formatter.parse(rs.getString("now"));
			formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm a");
			out.println(formatter.format(today));
		}
%>	
						<br/><img src="../images/business/sub_stitle01.gif" alt="Jumlah  Pelanggan Saat ini" /></li>
						<li class="money">
<%	
		SQL = "SELECT COUNT(1) as counter FROM cust_master where status = 'W'";
		
		rs = stmt.executeQuery(SQL);
		
		while (rs.next()) {
			NumberFormat nf = new DecimalFormat("#,###,###");
			String count = nf.format(rs.getDouble("counter"));
			if (count.length()<4)
				out.println("000.000." + ("000"+count).substring(count.length(), count.length()+3));
			else if (count.length()<8 && count.length()>3)
				out.println("000." + ("000.000"+count).substring(count.length(), count.length()+7).replace(",", "."));
			else if (count.length()<12 && count.length()>7)
				out.println(("000.000.000"+count).substring(count.length(), count.length()+11).replace(",", "."));
			else
				out.println(count.replace(",", "."));
		}
    } catch (java.sql.SQLException e) {   
        e.printStackTrace();   
    } catch (Exception e) {
    	e.printStackTrace();
    } finally{   
        try {   
            if(stmt !=null) stmt.close();   
            if(con !=null) con.close();   
        } catch (java.sql.SQLException e) {   
            e.printStackTrace();   
        }   
    }   
%>
						</li>
					</ul>
				</div>
				<div class="clear"></div>
				<div class="ta_top"></div>
				<div class="ta_bg">
					<div class="bs_con">
						<p><img src="../images/gaul/bg_gaul.jpg" width="595" height="840" alt="" /></p>
						<p style="padding:20px 0 0 20px;">
						<p class="td_right"><a href="../document/form_pendaftaran.pdf" onfocus="this.blur()"><img src="../images/gaul/bt_gaul.gif" alt="" /></a></p>
					</div>
				</div>
				<div class="ta_bot"></div>
			</div>	

		</div>
	</div>
<jsp:include page="../bizring_footer1.jsp"/>
</BODY>
</HTML>
